/*
 * tcprecord.cc
 *
 *  Created on: Dec 16, 2014
 *      Author: root
 */
/******************************************************************************************************************/
#include <math.h>
#include <string.h>
#include <stdio.h>
#include "tcprecord.h"
#include "../util/define.h"
/******************************************************************************************************************/
TcpRecord::TcpRecord(TcpStat* stat) :
		Record(NUM_TCP_ATTR) {
	this->attr[CS_DATA_PP] = stat->cs_bytes * 1.0 / stat->cs_pkts;
	this->attr[SC_DATA_PP] = stat->sc_bytes * 1.0 / stat->sc_pkts;
	this->attr[CS_PSH] = stat->cs_psh;
	this->attr[SC_PSH] = stat->sc_psh;
	SetLabel(stat->label);
	Standardize();
}
void TcpRecord::Standardize() {
	this->attr[CS_DATA_PP] /= MAX_DATA;
	this->attr[SC_DATA_PP] /= MAX_DATA;
	this->attr[CS_PSH] /= FIRST_N_TCP;
	this->attr[SC_PSH] /= FIRST_N_TCP;
}
/******************************************************************************************************************/
